Add basic buffer pruner#1829
Open
yerzhan7 wants to merge 4 commits into
Open
Conversation
Signed-off-by: Yerzhan Mazhkenov <20302932+yerzhan7@users.noreply.github.com>
770fe63 to
afc223a
Compare
…ignal Signed-off-by: Yerzhan Mazhkenov <20302932+yerzhan7@users.noreply.github.com>
952374c to
44d483a
Compare
Conflicts resolved: - limiter.rs: drop the `active_reads` DashMap (subsumed by upstream's unified `cursors: DashMap<CursorId, Weak<CursorState>>` where each CursorState owns its `active_read: Mutex<Option<ActiveRead>>`). Keep `pruning_signal` and the pruning hooks. - limiter.rs: rewrite `has_active_reads()` to iterate `cursors` and upgrade each Weak, since active-read state now lives per-cursor. - pool.rs: drop the obsolete `inner_stats`/`inner_limiter` test helpers and the `reserve`/`try_reserve`/`release_cursor`/`next_cursor_id` delegation methods replaced by upstream's `create_cursor` API. Keep the `inner()` accessor for the maintenance test. - pool.rs: re-add `#[cfg_attr(feature = "shuttle", allow(dead_code))]` on `inner()` since the maintenance test that uses it is gated `not(feature = "shuttle")`. - memory.rs: keep modules in alphabetical order (`maintenance` between `limiter` and `pages`). Signed-off-by: Yerzhan Mazhkenov <20302932+yerzhan7@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Skeleton for the background buffer pruner that will reclaim memory from idle prefetch handles under memory pressure.
What changed:
WakeSignalprimitive (Mutex<bool>+Condvar): coalescing single-consumer wake with optional timeout.maintenancethread that runs both periodic pool trim and on-demand pruning rounds. Replaces the standaloneschedule_trimthread — one thread now handles both responsibilities.MemoryLimitergainstrigger_pruning()(notify) andpruning_signal(); onDropit notifies the signal so the maintenance thread observes the deadWeakand exits.run_pruning_roundskeleton: pool trim → check queue → defer to natural release path → drop one idle prefetch handle. Queue inspection and handle drop are stubs returningIdle/falsefor now.Why
Mutex<bool>+Condvarwait_timeoutset the pending flag and are observed on the next call.Sleep behavior:
trigger_pruning()— pressure starts → immediate wake.Does this change impact existing behavior?
No
Does this change need a changelog entry? Does it require a version change?
No
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).